package com.faxsun.core.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.faxsun.core.persist.dao.TraceDao;
import com.faxsun.core.persist.entity.TracePO;
import com.faxsun.core.service.TraceService;

@Transactional
public class TraceServiceImpl implements TraceService{
	
    @Autowired
    TraceDao traceDao;

    @Override
    public Iterable<TracePO> batchSave(List<TracePO> traces) {
        
        List<TracePO> result = new ArrayList<TracePO>();

        if (traces == null) {
            return result;
        }

        for (TracePO entity : traces) {
            traceDao.saveOrUpdate(entity);
            result.add(entity);
        }

        return result;
    }
	
}
